package cn.tedu.management.portal.service.impl;

import cn.tedu.management.portal.ex.InsertException;
import cn.tedu.management.portal.ex.MessageExist;
import cn.tedu.management.portal.model.Attendance;
import cn.tedu.management.portal.mapper.AttendanceMapper;
import cn.tedu.management.portal.service.IAttendanceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tedu.cn
 * @since 2020-12-08
 */
@Service
public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attendance> implements IAttendanceService {

    @Autowired
    AttendanceMapper attendanceMapper;

    @Override
    public void updateAttendance(int staffId, double absenceCount,int holiday) {
        if(absenceCount<0||holiday<0){
            throw new InsertException("出入参数有错！");
        }
        attendanceMapper.updateAttendanceByStaffId(staffId,absenceCount,holiday);

    }
}
